Skip to content

[msbuild] Embed app extensions even when ReferenceOutputAssembly is false. Fixes #26453 - #26476

Merged
rolfbjarne merged 4 commits into
mainfrom
dev/rolf/issue-26453-appextension-referenceoutputassembly
Sep 2, 2026
Merged

rolfbjarne merged 4 commits into
mainfrom
dev/rolf/issue-26453-appextension-referenceoutputassembly

Conversation

@rolfbjarne

Copy link
Copy Markdown
Member

The _ResolveAppExtensionReferences target only added a referenced app
extension to _ResolvedAppExtensionReferences when the project reference
didn't have ReferenceOutputAssembly=false. The MSBuild task itself was
executed unconditionally, so the app extension was still built - it just never
made it into the container app's PlugIns directory. The build succeeded with
no errors and no warnings, which made this very hard to diagnose.

ReferenceOutputAssembly=false means "don't reference the output assembly of
this project reference from the compiler", which is exactly what you'd want for
an app extension (the container app never compiles against the extension's code

  • they're separate processes). It says nothing about whether the extension
    should be embedded in the container app, so it shouldn't affect the embedding at
    all.

This condition dates back to when app extension support was first added
(xamarin/maccore@71e3baeeb2d8d8421b0d67943e0925ea2916cc60), and there doesn't
seem to be any reason for it, so just remove it.

The target has two MSBuild invocations, and both had the same problem, so
there's a test for each of them (one for when we build the referenced extension
projects, and one for when they've already been built). Both tests were verified
to fail without the fix.

Fixes #26453

🤖 Pull request created by Copilot

rolfbjarne and others added 3 commits August 27, 2026 00:57
…alse. Fixes #26453

The `_ResolveAppExtensionReferences` target only added a referenced app
extension to `_ResolvedAppExtensionReferences` when the project reference
didn't have `ReferenceOutputAssembly=false`. The `MSBuild` task itself was
executed unconditionally, so the app extension was still built - it just
never made it into the container app's `PlugIns` directory. The build
succeeded with no errors and no warnings, which made this very hard to
diagnose.

`ReferenceOutputAssembly=false` means "don't reference the output assembly
of this project reference from the compiler", which is exactly what you'd
want for an app extension (the container app never compiles against the
extension's code - they're separate processes). It says nothing about
whether the extension should be embedded in the container app, so it
shouldn't affect the embedding at all.

This condition dates back to when app extension support was first added
(xamarin/maccore@71e3bae), and there
doesn't seem to be any reason for it, so just remove it.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 57a20054-5162-48cd-97a2-58bceaa09807
…ssembly=false

Verified that this test fails without the previous commit's fix, and
passes with it.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 57a20054-5162-48cd-97a2-58bceaa09807
…putAssembly=false

The '_ResolveAppExtensionReferences' target has two <MSBuild> invocations,
and both had the bug. The existing test only covers the one that builds the
referenced extension projects, since '_BuildReferencedExtensionProjects'
defaults to true, so add a test for the other one as well (which is the code
path some versions of the IDE take).

Verified that this test fails if the fix is reverted.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 57a20054-5162-48cd-97a2-58bceaa09807
Copilot AI lite review requested due to automatic review settings August 27, 2026 14:55

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a silent packaging bug in the MSBuild app-extension embedding pipeline: app extension project references marked with ReferenceOutputAssembly=false are now still included in _ResolvedAppExtensionReferences, so the container app embeds the produced .appex under PlugIns/ as intended.

Changes:

  • Remove ReferenceOutputAssembly != false filtering when collecting app extension bundle paths from the _ResolveAppExtensionReferences target.
  • Add unit test coverage for ReferenceOutputAssembly=false for both _ResolveAppExtensionReferences MSBuild code paths (prebuilt vs built-as-part-of-container build).
  • Add a test-only ProjectReference metadata hook in the ExtensionConsumer test project to toggle ReferenceOutputAssembly from tests.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
msbuild/Xamarin.Shared/Xamarin.Shared.targets Ensures app extension bundle outputs are captured regardless of ReferenceOutputAssembly, enabling embedding into the container app.
tests/dotnet/UnitTests/ProjectTest.cs Adds regression tests to verify extensions are embedded even when ReferenceOutputAssembly=false, including the “prebuilt extension” path.
tests/dotnet/ExtensionConsumer/shared.csproj Adds conditional ReferenceOutputAssembly metadata to enable the new regression tests.

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

Comment thread tests/dotnet/UnitTests/ProjectTest.cs Resolved
@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@rolfbjarne
rolfbjarne enabled auto-merge (squash) August 28, 2026 08:53
@rolfbjarne rolfbjarne added the ready-to-review This PR is ready to review/merge. label Aug 28, 2026
@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

✅ API diff for current PR / commit

NET (empty diffs)

✅ API diff vs stable

NET (empty diffs)

ℹ️ Generator diff

Generator Diff: vsdrops (html) vsdrops (raw diff) gist (raw diff) - Please review changes)

Pipeline on Agent
Hash: 5724cdf9b627307eeeb8b3b690d00dc54293acee [PR build]

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

🚀 [CI Build #5724cdf] Test results 🚀

Test results

✅ All tests passed on VSTS: test results.

🎉 All 264 tests passed 🎉

Tests counts

✅ assembly-processing: All 1 tests passed. Html Report (VSDrops) Download
✅ cecil: All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (iOS): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (MacCatalyst): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (macOS): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (Multiple platforms): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (tvOS): All 1 tests passed. Html Report (VSDrops) Download
✅ framework: All 2 tests passed. Html Report (VSDrops) Download
✅ fsharp: All 4 tests passed. Html Report (VSDrops) Download
✅ generator: All 5 tests passed. Html Report (VSDrops) Download
✅ interdependent-binding-projects: All 4 tests passed. Html Report (VSDrops) Download
✅ introspection: All 7 tests passed. Html Report (VSDrops) Download
✅ linker (iOS): All 31 tests passed. Html Report (VSDrops) Download
✅ linker (MacCatalyst): All 31 tests passed. Html Report (VSDrops) Download
✅ linker (macOS): All 21 tests passed. Html Report (VSDrops) Download
✅ linker (tvOS): All 31 tests passed. Html Report (VSDrops) Download
✅ monotouch (iOS): All 25 tests passed. Html Report (VSDrops) Download
✅ monotouch (MacCatalyst): All 25 tests passed. Html Report (VSDrops) Download
✅ monotouch (macOS): All 20 tests passed. Html Report (VSDrops) Download
✅ monotouch (tvOS): All 25 tests passed. Html Report (VSDrops) Download
✅ msbuild: All 2 tests passed. Html Report (VSDrops) Download
✅ sharpie: All 1 tests passed. Html Report (VSDrops) Download
✅ windows: All 3 tests passed. Html Report (VSDrops) Download
✅ xcframework: All 4 tests passed. Html Report (VSDrops) Download
✅ xtro: All 1 tests passed. Html Report (VSDrops) Download

macOS tests

✅ Tests on macOS Sonoma (14): All 5 tests passed. Html Report (VSDrops) Download
✅ Tests on macOS Sequoia (15): All 5 tests passed. Html Report (VSDrops) Download
✅ Tests on macOS Tahoe (26): All 5 tests passed. Html Report (VSDrops) Download

Linux Build Verification

✅ Linux build succeeded

Pipeline on Agent
Hash: 5724cdf9b627307eeeb8b3b690d00dc54293acee [PR build]

@rolfbjarne
rolfbjarne merged commit f257bc2 into main Sep 2, 2026
54 checks passed
@rolfbjarne
rolfbjarne deleted the dev/rolf/issue-26453-appextension-referenceoutputassembly branch September 2, 2026 11:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

copilot ready-to-review This PR is ready to review/merge.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

App Extension (.appex) builds correctly but is never copied into PlugIns/ during publish (net10.0-ios, IsAppExtension ProjectReference)

5 participants